package com.cskaoyan.market.errorcontroller;

import com.cskaoyan.market.db.domain.Result;
import com.cskaoyan.market.exception.ValidationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(ValidationException.class)
    public Object exp1(ValidationException validationException){
        Integer code = validationException.getCode();
        String message = validationException.getMessage();
        return new Result(code, message, null);
    }
}
